var express = require('express');
var router = express.Router();
var connection = require('./db');

/* GET home page. */
router.post('/', function(req, res, next) {
    //res.render('index', { title: 'Express' });
    connection.query('select * from people', function(error, results, fields) {
        if (error) throw error;
        res.send({
            code: 200,
            msg: '查询成功',
            list: results
        });
    });
});
// router.post('/a', function(req, res, next) {
//     //res.render('index', { title: 'Express' });
//     connection.query('select * from people', function(error, results, fields) {
//         if (error) throw error;
//         res.send({
//             code: 200,
//             msg: '查询成功',
//             list: results
//         });
//     });
// });

module.exports = router;